import {FormOptionItem, NumberArrOfStringArr, NumberOfString} from "@/interface/FormInterface";

export default {
    input(name: string, title = '', value = '', placeholder = '') {
        return {
            name,
            title,
            value,
            placeholder,
            type: 'input',
        }
    },
    select(name: string, options: FormOptionItem[], title = '', value: NumberOfString = '', placeholder = '') {
        return {
            name,
            title,
            value,
            options,
            placeholder,
            type: 'select',
        }
    },
    radio(name: string, options: FormOptionItem[], title = '', value: NumberOfString = '', placeholder = '') {
        return {
            name,
            title,
            value,
            options,
            placeholder,
            type: 'radio',
        }
    },
    checkbox(name: string, options: FormOptionItem[], title = '', value: NumberArrOfStringArr = [], placeholder = '') {
        return {
            name,
            title,
            value,
            options,
            placeholder,
            type: 'checkbox',
        }
    },
    dateRange(
        name: string,
        title = '',
        value: string[] = [],
        startPlaceholder = '开始日期',
        endPlaceholder = '结束日期',
    ) {
        return {
            name,
            title,
            value,
            startPlaceholder,
            endPlaceholder,
            type: 'dateRange',
        }
    },
    timeRange(
        name: string,
        title = '',
        value: string[] = [],
        startPlaceholder = '开始时间',
        endPlaceholder = '结束时间'
    ) {
        return {
            name,
            title,
            value,
            startPlaceholder,
            endPlaceholder,
            type: 'timeRange',
        }
    },
    datetimeRange(
        name: string,
        title = '',
        value: string[] = [],
        startPlaceholder = '开始时间',
        endPlaceholder = '结束时间'
    ) {
        return {
            name,
            title,
            value,
            startPlaceholder,
            endPlaceholder,
            type: 'datetimeRange',
        }
    },
}